package test0109;

public class Test02 {
    public static void main(String[] args) {
        // (2)统计字符串中某个字符串出现的次数
        String s = "lskdabcjfsaabcdkfhwerwerabc";
        int i = m(s, "abc");
        System.out.println(i);
    }
    public static int m(String s, String t) {

        int j=0;
        for (int i=0;i<s.length()-2;i++) {
            String x=s.substring(i,i+3);
            if(x.equals(t)){
                j=j+1;
            }
        }
        return j;
    }
}
